package com.bdqn.Short.jd2;


import com.bdqn.Short.jd1.Equip;
import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;


@Aspect
public class PlayerLogger {
    private static Logger logger=Logger.getLogger(PlayerLogger.class);
    /**
     * 前置增强代码
     */
    @Before("execution(* com.bdqn.Short.jd1.Player.updateEquip(com.bdqn.Short.jd1.Equip))")
    public void before(JoinPoint jp) {
        Equip equip= (Equip) jp.getArgs()[0];
        String name=equip.getName();
        equip.setName("紫色梦幻"+name);
        equip.setAttackPlus(equip.getAttackPlus()+6);
        equip.setDefencePlus(equip.getDefencePlus()+6);
        System.out.println(name+"成功升级为"+equip.getName());
    }
}
